Skip to content

feat: add failure analyzer for systematic PR failure tracking#26

Merged
ADWilkinson merged 1 commit into
mainfrom
barbossa/failure-analyzer-2026-01-08
Jan 8, 2026
Merged

feat: add failure analyzer for systematic PR failure tracking#26
ADWilkinson merged 1 commit into
mainfrom
barbossa/failure-analyzer-2026-01-08

Conversation

@ADWilkinson

Copy link
Copy Markdown
Owner

Summary

Implements issue #25 - FailureAnalyzer class that systematically records and analyzes PR failures to help prevent repeated mistakes. This addresses the development focus on agent reliability and error recovery.

Key capabilities:

  • Records failures to logs/failures.jsonl with structured metadata (issue ID, category, root cause, evidence)
  • Categorizes failures into standardized types (missing_tests, ci_failures, scope_creep, etc.)
  • Provides similar failure matching so Engineers get warned about past mistakes before starting work
  • Generates failure pattern analysis for Auditor health reports
  • Configurable backoff policy to avoid reworking issues that repeatedly fail

Evidence

Dependencies

  • Lockfile changes: NO
  • Dependency changes: NONE

Changes

New Files

  • src/barbossa/utils/failure_analyzer.py (663 lines) - Core FailureAnalyzer class with:

    • record_failure() - Record failures with structured metadata
    • get_similar_failures() - Find matching past failures by keywords/labels
    • get_failure_warnings() - Formatted warnings for Engineer prompts
    • should_skip_issue() - Backoff policy check for repeatedly failing issues
    • analyze_failure_patterns() - Pattern analysis for Auditor reports
    • rotate_failures() - 90-day retention cleanup
  • tests/test_failure_analyzer.py (542 lines) - Comprehensive test suite with 23 tests

Modified Files

  • src/barbossa/agents/tech_lead.py - Records failures when closing PRs
  • src/barbossa/agents/engineer.py - Queries failure history before starting issues
  • src/barbossa/agents/auditor.py - Includes failure patterns in health reports
  • prompts/engineer.txt - Added {{failure_warnings_section}} placeholder
  • config/repositories.schema.json - Added failure_analyzer settings schema

Testing

  • All 23 new tests pass: PYTHONPATH=src python -m unittest tests.test_failure_analyzer -v
  • Agent imports verified: All three agents (Tech Lead, Engineer, Auditor) import successfully
  • Existing tests unaffected (pre-existing import issues in older tests are separate)

Configuration Example

{
  "settings": {
    "failure_analyzer": {
      "enabled": true,
      "retention_days": 90,
      "backoff_policy": {
        "skip_runs_after_failures": 1,
        "consecutive_failures_threshold": 2
      }
    }
  }
}

🤖 Generated with Claude Code

Implements issue #25 - FailureAnalyzer class that records and analyzes
PR failures to help prevent repeated mistakes.

Key features:
- Records failures to logs/failures.jsonl with structured metadata
- Categorizes failures (missing_tests, ci_failures, scope_creep, etc.)
- Provides similar failure matching for Engineer awareness
- Generates failure pattern analysis for Auditor health reports
- Configurable backoff policy to avoid reworking failing issues
- 90-day retention with automatic rotation

Integration:
- Tech Lead: Records failures when closing PRs with reasoning
- Engineer: Gets warnings about similar past failures before starting
- Auditor: Includes failure patterns in health reports and insights

Configuration (repositories.json):
```json
{
  "settings": {
    "failure_analyzer": {
      "enabled": true,
      "retention_days": 90,
      "backoff_policy": {
        "skip_runs_after_failures": 1,
        "consecutive_failures_threshold": 2
      }
    }
  }
}
```

Closes #25

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ADWilkinson ADWilkinson merged commit 4aa503b into main Jan 8, 2026
1 check passed
@ADWilkinson ADWilkinson deleted the barbossa/failure-analyzer-2026-01-08 branch January 8, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant